package com.test.languagetest;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;

import com.pojo.Product;

public class HibernateTestSaveMany {

	
	public static void main(String[] args) {
		
		SessionFactory sf = new Configuration().configure().buildSessionFactory();
		Session s = sf.openSession();
		s.beginTransaction();
		
		for(int i=0;i<10;i++) {
			Product p = new Product();
			p.setName("phone" + i);
			p.setPrice(5000+i);
			s.save(p);
		}
		
		s.beginTransaction().commit();
		s.close();
		sf.close();
		
	}
}
